package com.ll.service.impl;

import com.ll.entity.Product;
import com.ll.mapper.ProductMapper;
import com.ll.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    ProductMapper productMapper;
    @Override
    public List<Product> list(Product product) {
        return productMapper.list(product);
    }

    @Override
    public String add(Product product) {
        return productMapper.add(product) > 0 ? "success" : "error";
    }

    @Override
    public Product detail(Integer productId) {
        return productMapper.detail(productId);
    }

    @Override
    public String update(Product product) {
        return productMapper.update(product) > 0 ? "success" : "error";
    }

    @Override
    public String delete(Integer productId) {
        return productMapper.delete(productId) > 0 ? "success" : "error";
    }
}
